@extends('layouts.header')
@section('title','编辑')
@section('content')
    <article class="page-container">
        <form class="form form-horizontal" id="myform" autocomplete="off">
            {{ csrf_form_field() }}
            <div class="row cl">
                <label class="form-label col-sm-3"><span class="c-red">*</span>名称：</label>
                <div class="formControls col-sm-7">
                    <input type="text" class="input-text required" value="{{$info->name}}" placeholder="" id="name" name="name" autofocus="autofocus" maxlength="50">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3"><span class="c-red">*</span>设备序列号：</label>
                <div class="formControls col-sm-7">
                    <input type="text" class="input-text required" value="{{$info->serial}}" placeholder="" id="serial" name="serial" autofocus="autofocus" maxlength="20">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">加密验证码：</label>
                <div class="formControls col-sm-7">
                    <input type="text" class="input-text" value="{{$info->valid_code}}" placeholder="" id="valid_code" name="valid_code" autofocus="autofocus" maxlength="20">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3"><span class="c-red">*</span>通道数量：</label>
                <div class="formControls col-sm-7">
                    <input type="number" class="input-text required" value="{{$info->channel_count}}" placeholder="" id="channel_count" name="channel_count" autofocus="autofocus" max="99" min="1">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">局域网相关IP配置：</label>
                <div class="formControls col-sm-7 panel panel-primary panel-body">
                    <div class="row cl">
                        <label class="form-label col-sm-3">录像机：</label>
                        <div class="formControls col-sm-7">
                            <input type="text" class="input-text" value="{{$info->lan_ip}}" placeholder="" id="lan_ip" name="lan_ip" autofocus="autofocus" maxlength="15">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-sm-3">服务器：</label>
                        <div class="formControls col-sm-7">
                            <input type="text" class="input-text" value="{{$info->server_lan_ip}}" placeholder="" id="server_lan_ip" name="server_lan_ip" autofocus="autofocus" maxlength="15">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3"><span class="c-red">*</span>用户名：</label>
                <div class="formControls col-sm-7">
                    <input type="text" class="input-text required" value="{{$info->username}}" placeholder="" id="username" name="username" autofocus="autofocus">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3"><span class="c-red">*</span>密 码：</label>
                <div class="formControls col-sm-7">
                    <input type="password" class="input-text required" value="{{$info->password}}" placeholder="" id="password" name="password" autofocus="autofocus">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-sm-3">状态：</label>
                <div class="formControls col-sm-7">
                    <label><input type="radio" value="0" name="ishide" @if($info->ishide == 0) checked @endif>显示</label>
                    <label class="ml-10"><input type="radio" value="1" name="ishide" @if($info->ishide == 1) checked @endif>隐藏</label>
                </div>
            </div>
            @csrf
            <div class="row cl pt-20 ">
                <div class="text-c">
                    <a class="btn btn-primary radius" id="sub"> &nbsp;&nbsp;提交&nbsp;&nbsp; </a>
                    <input class="btn btn-danger radius ml-15" type="button" value="&nbsp;&nbsp;关闭&nbsp;&nbsp;" onclick="layer_close();">
                </div>
            </div>
        </form>

    </article>

    <script type="text/javascript">
        $(function () {
            $("#sub").on('click', function () {
                if ($('#myform').valid()) {
                    ajaxForm('post', '', 'myform', formSub);
                    function formSub(data) {
                        //判断结果刷新
                        if (data === '1') {
                            parent.table_reload(0); //0停留在当前页，1回到第一页
                        }
                    }
                }
            });
        })
    </script>
    <!--/请在上方写此页面业务相关的脚本-->
@endsection
